import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

// pinia没有mutations和modules，每一个defineStore就是一个modules，所以要注意
export const useCounterStore = defineStore('counter', () => {
  const count = ref(0) // state
  const doubleCount = computed(() => count.value * 2) // getters
  const increment = () => count.value++ // actions

  return { count, doubleCount, increment }
})
